# -- coding: utf-8 --
import sys
from PythonBasicTest.help import HelpCommand
from PythonBasicTest.cp import CpCommand
from PythonBasicTest.ls import LsCommand
from PythonBasicTest.rm import RmCommand
from PythonBasicTest.cat import CatCommand







def action():
    print(">",end='')
    line = input()
    args = line.split()
    if len(args) == 0:
        return "cnm没输啊"
    arg0 = args[0]
    if arg0 == 'exit':
        sys.exit()
    elif arg0 == 'cat':
        command = CatCommand(args)
    elif arg0 == 'ls':
        command = LsCommand(args)
    elif arg0 == 'cp':
        command = CpCommand(args)
    elif arg0 == 'rm':
        command = RmCommand(args)
    else:
        command = HelpCommand(args)


    command.execute()

while True:
    try:
        action()
    except IOError as E:
        print(E)
